package com.micangcaihang.common.base.mvp;

import android.content.Context;

import com.micangcaihang.common.baserx.RxManager;


/**
 * <pre>
 *     author : Fandy
 *     e-mail : fandayonggmail@gmail.com
 *     time   : 2017/06/16
 *     desc   : 基类presenter
 *     version: 1.0
 * </pre>
 */
public abstract class BasePresenter<T extends IBaseView> {
    protected Context mContext;
    protected T mView;
    protected RxManager mRxManage = new RxManager();

    public void setV(T v) {
        this.mView = v;
        this.onAttached();
    }

    public void onAttached() {
    }

    public void onDetached() {
        mRxManage.clear();
    }

    /**
     * 每次进入界面获取网络数据，更新界面
     *
     * @param isRefresh 新增参数，用来判断是否为下拉刷新调用，下拉刷新的时候不应该再显示加载界面和异常界面
     */
    public abstract void loadFirstData(boolean isRefresh);

    /**
     * 加载更多数据
     */
    public abstract void loadMoreData();
}
